package org.szy.core.common.exception;

import cn.hutool.core.util.StrUtil;

/**
 * 基础异常类
 *
 * @author wangbuhao
 * @date 2023-02-08
 * @since 1.0.0
 **/
public class BaseException extends RuntimeException {

    private Integer code;

    private String msg;


    public BaseException() {
        super("服务器异常");
        this.code = 500;
        this.msg = "服务器异常";
    }

    public BaseException(String msg, Object... arguments) {
        super(StrUtil.format(msg, arguments));
        this.code = 500;
        this.msg = StrUtil.format(msg, arguments);
    }

    public BaseException(Integer code, String msg, Object... arguments) {
        super(StrUtil.format(msg, arguments));
        this.code = code;
        this.msg = StrUtil.format(msg, arguments);
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }
}
